export default (promises: Promise<unknown>[]) => {
    return new Promise((resolve, reject) => {
        let result: Promise<unknown>[] = []
        let index = 0
        for (let i = 0; i < promises.length; i++) {
            promises[i]
                .then((res) => {
                    result[i] = res as Promise<unknown>
                    index++
                    if (index >= promises.length) resolve(result)
                })
                .catch((err) => {
                    reject(err)
                })
        }
    })
}
